import { createRouter, createWebHistory } from 'vue-router'
// 一级路由
import homeView from '@/views/home/home.vue'

// 二级路由
import homeView from '@/views/home/children/index.vue'
import claView from '@/views/home/children/cla.vue'
import cartView from '@/views/home/children/cart.vue'
import myView from '@/views/home/children/my.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/home',
      name: 'home',
      component: homeView,
      children: [
        {
          path: 'index',
          name: 'index',
          component: indexView,
        },
        {
          path: 'cla',
          name: 'cla',
          component: claView,
        },
        {
          path: 'cart',
          name: 'cart',
          component: cartView,
        },
        {
          path: 'my',
          name: 'my',
          component: myView,
        },
      ]
    },
    {
      path: '/',
      redirect: "/home/index"
    }
  ],
})

export default router
